/*
 * IOcard.cpp
 *
 *  Created on: Mar 28, 2012
 *      Author: pleun
 */

#include "IOcard.h"

void IOcard::run() {
	int bufferindex = 0;
	for(;;){
		buffsys->updateBuffer(buffer[bufferindex],camerabuffer[bufferindex]);
		buffsys->unlock();
		bufferindex++;
		if(bufferindex==3){
			bufferindex=0;
		}
		Thread::msleep(200);
	}
}

void IOcard::setBeeld(char beeld, int camera){
	if(camera == 1 || camera == 2 || camera == 3){
		buffer[0] = beeld;
		camerabuffer[0] = camera;
	}
	else if(camera == 4 || camera == 5 || camera == 6){
		buffer[1] = beeld;
		camerabuffer[1] = camera;
	}
	else if(camera == 7 || camera == 8 || camera == 9){
		buffer[2] = beeld;
		camerabuffer[2] = camera;
	}
}

